package com.hydl.power.service.impl;

import com.hydl.power.mapper.CityMapper;
import com.hydl.power.pojo.City;
import com.hydl.power.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityMapper cityMapper;

    /**
     * 查询城市
    * */
    @Override
    public List<City> queryCity() {
        return cityMapper.queryCity();
    }


    @Override
    public List<City> queryCityByToken(String projectId,String token) {
        return cityMapper.queryCityByToken(projectId,token);
    }

    /**
     * 添加城市
     * */
    @Override
    public int addCity( String cityName,String cityCode) {
        return cityMapper.addCity(cityName,cityCode);
    }

    /**
     * 根据id删除城市
     * */
    @Override
    public int deleteCityById(Integer id) {
        return cityMapper.deleteCityById(id);
    }

    /**
     * 根据id修改城市
     * */
    @Override
    public int updateCity(String cityName, Integer id) {
        return cityMapper.updateCity(cityName,id);
    }

    /**
     * 根据id查询城市
     * */
    @Override
    public City queryCityById(Integer id) {
        return cityMapper.queryCityById(id);
    }
}
